repo.or.cz
/
and.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Adding some more judges, here and there.
[and.git]
/
COCI
/
2009-2010
/
Contest #7 - 24.04.2010
/
cokolada
/
cokolada.cpp
blob
940af42c95fa86da6a397f6c42fe28e4bab6a46b
1
#include <iostream>
2
#include <cassert>
3
4
#define D(x) cout << #x
" = "
<< (x) << endl
5
using namespace
std
;
6
7
int
main
(){
8
int
k
;
9
cin
>>
k
;
10
11
int
p
=
1
;
12
while
(
p
<
k
){
13
p
<<=
1
;
14
}
15
16
17
cout
<<
p
<<
" "
;
18
19
int
s
=
1
;
20
while
(!(
k
&
s
)){
21
s
<<=
1
;
22
}
23
// s = smallest power of two in k
24
25
int
ans
=
0
;
26
while
(
p
>
s
){
27
p
>>=
1
;
28
ans
++;
29
}
30
assert
(
p
==
s
);
31
cout
<<
ans
<<
endl
;
32
33
return
0
;
34
}